<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>Sign Up Login</title>
<link rel="stylesheet" href="\js\login\style.css">
</head>

<body>
<!-- 引入bootstrap的css -->
<link rel="stylesheet" href="\js\bootstrap\bootstrap3\css\bootstrap.css"></link>
<link rel="stylesheet" href="\js\bootstrap\bootstrap3\css\bootstrap-theme.css"></link>
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
<link rel='stylesheet prefetch' href='https://fonts.googleapis.com/icon?family=Material+Icons'>
<script type="text/javascript" src="\js\bootstrap\bootstrap3\js\bootstrap.js"></script>

<div class="cotn_principal">
  <div class="cont_centrar">
    <div class="cont_login">
      <div class="cont_info_log_sign_up">
        <div class="col_md_login">
          <div class="cont_ba_opcitiy">
            <h2>LOGIN</h2>
            <p>Lorem ipsum dolor sit amet, consectetur.</p>
            <button class="btn_login" onClick="cambiar_login()">LOGIN</button>
          </div>
        </div>
        <div class="col_md_sign_up">
          <div class="cont_ba_opcitiy">
            <h2>SIGN UP</h2>
            <p>Lorem ipsum dolor sit amet, consectetur.</p>
            <button class="btn_sign_up" onClick="cambiar_sign_up()">SIGN UP</button>
          </div>
        </div>
      </div>
      <div class="cont_back_info">
        <div class="cont_img_back_grey"> <img src="\js\login\po.jpg" alt="" /> </div>
      </div>

      <div class="cont_forms" >
        <div class="cont_img_back_"> <img src="\js\login\po.jpg" alt="" /> </div>
        <div class="cont_form_login"> <a href="#" onClick="ocultar_login_sign_up()" ><i class="material-icons">&#xE5C4;</i></a>
          <h2>LOGIN</h2>
          <input type="text" placeholder="用户名" name="name" />
          <input type="password" placeholder="密码" name="pwd" />
          <button class="btn_login" type="button" onclick="login()">登录</button>
        </div>
        <form id="userForm">
        <div class="cont_form_sign_up"> <a href="#" onClick="ocultar_login_sign_up()"><i class="material-icons">&#xE5C4;</i></a>
          <h2>SIGN UP</h2>
          <input type="text" placeholder="用户名" name="name"/>
          <input type="password" placeholder="密码" name="pwd"/>
          <input type="password" placeholder="确认密码" name="confirm"/>
           <br>
            <!--<select class="selectpicker form-control" data-live-search="true" style="height: 50px" name="countyId" id="countyId">
                </select>
            <input type="text" placeholder="影院名称" name="cinema"/>-->
          <button class="btn_sign_up" onClick="zc()">注册</button>

        </div>
        </form>
      </div>
    </div>
  </div>
</div>

<script src="\js\login\index.js"></script>
<script src="\js\jquery.min.js"></script>
</body>

<script>
/*
    $(function () {
        position();
    })*/

  //商家登录
  login=function () {
    $.ajax({
      url:"/sec/login",
      data:{name:$('input[name="name"]').val(),pwd:$('input[name="pwd"]').val()},
      success:function(data){
        alert(data.info);
        if (data.info=="登录成功" && data.role == 1) {
          location.href = data.url;
        }
        if (data.info=="登录成功" && data.role == 0){
          location.href = data.url;
        }
      }
    })
  }

  //商家注册
  function zc(){
    $.ajax({
      url:'/sec/addUser',
      type:'post',
      data:$('#userForm').serialize(),
      success:function(data){
        alert(data.info);
        zc();
      }
    })
  }

</script>
</html>
